package com.local.order.mapper;

import com.local.order.pojo.Order;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface OrderMapper {


    /**
     * 查询列表，支持翻页
     * @param start
     * @param limit
     * @param sort
     * @param order
     * @param isDeleted
     * @return
     */
    public List<Order> findOrderList(Integer start, Integer limit, String sort, String order, Integer isDeleted);

    /**
     * 查询订单总数
     * @param isDeleted
     * @return
     */
    public Integer getTotalOrders(Integer isDeleted);

    /**
     * 后台修改订单，通过order id
     * @param order
     * @return
     */
    public Integer update(Order order);

    /**
     * 通过ids批量查询订单列表
     * @param ids
     * @return
     */
    public List<Order> selectByIds(Integer[] ids);

    /**
     * 通过ids批量修改订单状态
     * @param ids
     * @param order_status
     * @param updateTime
     * @return
     */
    public Integer updateStatusByIds(Integer[] ids, Integer order_status, String updateTime);


    /**
     * 通过id查询订单
     * @param orderId
     * @return
     */
    public Order selectById(Integer orderId);


    /**
     * 生成订单
     * @param order
     * @return
     */
    public Integer save(Order order);


    /**
     * 通过orderNo查询订单
     * @param orderNo
     * @return
     */
    public Order getByOrderNo(String orderNo);


    /**
     * 更新订单支付状态
     * @param order
     * @return
     */
    public Integer updatePayStatus(Order order);


    /**
     * 查询用户的订单列表
     * @param userId
     * @param start
     * @param limit
     * @param isDeleted
     * @return
     */
    public List<Order> findUserOrderList(Integer userId, Integer start, Integer limit, Integer isDeleted);


    /**
     * 查询用户的订单数量
     * @param userId
     * @param isDeleted
     * @return
     */
    public Integer getTotalUserOrder(Integer userId, Integer isDeleted);
}
